package Demo01;

import java.util.LinkedList;

public class Demo02LinkedList {
    public static void main(String[] args) {
        demo01();
    }
    private static void demo01(){
        LinkedList<String> linked = new LinkedList<>();
        linked.add("a");
        linked.add("b");
        linked.add("c");
        linked.addFirst("www");
        linked.addLast("sss");
        linked.add(0,"dd");
        System.out.println(linked);

        String first = linked.getFirst();
        String last = linked.getLast();
        System.out.println(first);
        System.out.println(last);

        linked.clear();
        System.out.println(linked);
    }
}
